package test;
import java.io.File;
import java.io.FileNotFoundException;

import javax.xml.bind.JAXBException;

import control.IOManager;
import data.HighScores;
import data.HighscoreEntry;
import data.Options;


/**
 * @author Yuliy Khorolinskyy
 *
 * Reaktionsspiel 
 *
 * 02.01.2012
 */

/**
 * @author Yuliy
 *
 */
class XMLTester{
	/**
	 * @param args
	 * @throws JAXBException 
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args) throws JAXBException, FileNotFoundException {
		
//		XMLTest t = new XMLTest();
		Options testOpt = new Options();
		Options.setOptionsFile(new File("res/optionsTest.xml"));
		
		HighScores testScr = new HighScores();
		HighScores.setHighscoresFile(new File("res/highscoresTest.xml"));
		
//		testScr.add(new HighscoreEntry("Player1", 3, 1230));
//		testScr.add(new HighscoreEntry("Player2", 3, 1000));
//		testScr.add(new HighscoreEntry("Player3", 4, 1230));
//		testScr.add(new HighscoreEntry("Player4", 4, 1130));
		
		IOManager.saveOptions(testOpt);
		IOManager.saveHighscores(testScr);
		Options testOpt2 = IOManager.loadOptions();
		HighScores testScr2 = IOManager.loadHighscores();
//		
//		JAXBContext context = JAXBContext.newInstance(XMLTest.class);
//		Marshaller m = context.createMarshaller();
//		m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE );
//		m.marshal(t, new FileOutputStream(xmlF));
//		
////		JAXB.marshal(new XMLTest(), new FileOutputStream("res/optionsTest.xml"));
//		
//		
//		
//		XMLTest t2 = JAXB.unmarshal(xmlF, XMLTest.class);
////
//		JAXB.marshal(testOpt2, System.out);
//		JAXB.marshal(testScr2, System.out);
	}

}
